/* ==================================================================== *
 *
 * This file is part of Mapics.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author Andrey Cherkashin <action.open@gmail.com>
 *
 * ==================================================================== */

/**
 * Creates current state of map layer
 *
 * @param data (JSONArray) {
 *      'center': {
 *          'lat': (double) Latitude,
 *          'lng': (double) Longitude
 *      },
 *      'zoom': (int) Zoom,
 *      'type': (int) Type,
 *      'overlays': {
 *          1: (Array) Array of mapics.MapObject
 *          ...
 *          n: (Array)
 *      },
 *      'events': (Array) Array of mapics.MapEventListener
 * }
 */
mapics.MapLayerState = function(data)
{
    this.m_Data = data;
};

/**
 * Check if this map layer state has center
 *
 * @return bool
 */
mapics.MapLayerState.prototype.hasCenter = function() {
    return ( this.m_Data.center != null );
};

/**
 * Returns center of this map layer state
 *
 * @return {
 *     'lat': (double) Latitude,
 *     'lng': (double) Longitude
 * }
 */
mapics.MapLayerState.prototype.getCenter = function() {
    return this.m_Data.center;
};

/**
 * Returns latitude of this map layer state
 *
 * @return double
 */
mapics.MapLayerState.prototype.getLat = function() {
    return this.m_Data.center.lat;
};

/**
 * Returns longitude of this map layer state
 *
 * @return double
 */
mapics.MapLayerState.prototype.getLng = function() {
    return this.m_Data.center.lng;
};

/**
 * Check if this map layer state has zoom
 *
 * @return bool
 */
mapics.MapLayerState.prototype.hasZoom = function() {
    return ( this.m_Data.zoom != null );
};

/**
 * Returns center of this map layer state
 *
 * @return int
 */
mapics.MapLayerState.prototype.getZoom = function() {
    return this.m_Data.zoom;
};

/**
 * Check if this map layer state has type
 *
 * @return bool
 */
mapics.MapLayerState.prototype.hasType = function() {
    return ( this.m_Data.type != null );
};

/**
 * Returns type of this map layer state
 *
 * @return int
 */
mapics.MapLayerState.prototype.getType = function() {
    return this.m_Data.type;
};

/**
 * Check if this map layer state has overlays
 *
 * @return bool
 */
mapics.MapLayerState.prototype.hasOverlays = function() {
    return ( this.m_Data.overlays != null );
};

/**
 * Returns overlays of this map layer state
 *
 * @return {
 *     1: (Array) Array of mapics.MapObject
 *     ...
 *     n: (Array)
 * }
 */
mapics.MapLayerState.prototype.getOverlays = function() {
    return this.m_Data.overlays;
};

/**
 * Check if this map layer state has event listeners
 *
 * @return bool
 */
mapics.MapLayerState.prototype.hasEventListeners = function() {
    return ( this.m_Data.events != null );
};

/**
 * Returns event listeners of this map layer state
 *
 * @return (Array) Array of mapics.MapEventListener
 */
mapics.MapLayerState.prototype.getEventListeners = function() {
    return this.m_Data.events;
};